package com.lyf.scm.plan.domain.util;

import com.lyf.scm.common.enums.OpContentEnum;
import com.lyf.scm.plan.insfrastructure.db.dataobject.OperationLogRecordDO;

/**
 * 错误日志实体生成工具类
 *
 * @author wangchlei
 * @date 2020/09/27
 */
public class OperationLogRecordUtil {

    /**
     * 获得大数据错误日志实体
     *
     * @param storeCode     门店编码
     * @param failReason    错误原因
     * @param operationData 哪张表
     * @return {@link OperationLogRecordDO}
     **/
    public static OperationLogRecordDO getBigDataErrorLog(String storeCode, Integer operationData, String failReason, long total, String time,String ext,String opContent) {
        OperationLogRecordDO operationLogRecordDO = new OperationLogRecordDO();
        operationLogRecordDO.setExt(ext);
        operationLogRecordDO.setOpContent(opContent);
        operationLogRecordDO.setOpStatus(2);
        operationLogRecordDO.setOpSign(storeCode);
        operationLogRecordDO.setOpSource(operationData);
        operationLogRecordDO.setFailReason(failReason);
        operationLogRecordDO.setOpAmount(total);
        operationLogRecordDO.setOpTime(time);
        return operationLogRecordDO;
    }

    /**
     * 获得大数据操作日志实体
     *
     * @param opSign
     * @param operationData
     * @return {@link OperationLogRecordDO}
     **/
    public static OperationLogRecordDO getBigDataOperationLog(String opSign, Integer operationData,String time,String ext,String opContent) {
        OperationLogRecordDO operationLogRecordDO = new OperationLogRecordDO();
        operationLogRecordDO.setExt(ext);
        operationLogRecordDO.setOpContent(opContent);
        operationLogRecordDO.setOpTime(time);
        //先使用成功状态，该数据着重记录标识
        operationLogRecordDO.setOpStatus(1);
        //使用随机标识（同一张表，同一批用的标识相同）
        operationLogRecordDO.setOpSign(opSign);
        //指代某张表
        operationLogRecordDO.setOpSource(operationData);
        return operationLogRecordDO;
    }
}
